package ks.server.controllers.requests;

import org.w3c.dom.Document;

import ks.framework.common.Message;
import ks.framework.communicator.Communicator;

public class ConfirmRequest {
	private Communicator com;
	
	public ConfirmRequest(Communicator c) {
		this.com = c;
	}
	
	/**
	 * Just send a confirm request.
	 * 
	 * @param tableNum
	 * @param player
	 * @return
	 */
	public boolean send(int tableNum, String player) {
		StringBuilder sb = new StringBuilder("<request version=\"1.0\" id=\"12345\">");
		sb.append("<confirm table=\"" + tableNum + "\" player=\"" + player + "\"/>");
		sb.append("</request>");
		
		Document d = Message.construct(sb.toString());
		Message r = new Message(d);
		r.setBroadcast();
		return com.distribute(r);
	}
}